from langchain_text_splitters import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
    #separator=["\n\n","\n"," ",""], #首先按段落分割，然后按行分割，最后按空格分割，如果都不行则按字符分割，这个是默认的
    chunk_size=20,
    chunk_overlap=4
)

text = "I Love \n English \n hello world,how about you? If you are looking to get started with chat models,"
chunks = splitter.split_text(text)
print(len(chunks))
for chunk in chunks:
    print(chunk)
    print(len(chunk))